<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/include.inc.jsp"%>


<SCRIPT type="text/javascript">
		
		var setting = {
			view: {
				dblClickExpand: false
			},

			data: {
				key: {
					name: "postName"
				},
				simpleData: {
					enable: true,
					idKey: "id",
					pIdKey: "parentId"
					
				}
			},
			callback: {
				onClick: onClick
			}
		};
		var zNodes = ${sysPostlist};

		$(document).ready(function(){
			$.fn.zTree.init($("#sysPostTree"), setting, zNodes);
			var zTree = $.fn.zTree.getZTreeObj("sysPostTree");
			zTree.expandAll(true);
			var node = zTree.getNodeByParam("id","${tid}",null);
			zTree.selectNode(node);
			$("#sysPost").loadUrl("${ctx}/sysPost/edit?id=${tid}","", "");
		});
		
		function onClick(e,treeId, treeNode) {
			var zTree = $.fn.zTree.getZTreeObj("sysPostTree");
			var sNodes = zTree.getSelectedNodes();
			if (sNodes.length > 0) {
				var tId = sNodes[0].id;
				$("#pIdsysPost").val(tId);
				$("#sysPost").loadUrl("${ctx}/sysPost/edit?id="+tId,"", "");
			}
			
		}
		
	</SCRIPT>

		<div class="tabsContent">
			<div>
	
				<div layoutH="10" style="float:left; display:block; overflow:auto;width:240px; border:solid 1px #CCC; line-height:21px; background:#fff">
				    <div>
						<ul id="sysPostTree" class="ztree"></ul>
					</div>
				    
				</div>
				
				<input type="hidden" id="pIdsysPost" value="${tid}"/> <!--添加时获取父ID，请勿删除  -->
				<div id="sysPost" style="margin-left:246px;">
					<!--#include virtual="list1.html" -->
				</div>
	
			</div>
			
		</div>

